package cn.ming.wfchat.app.dialog;

import android.os.Bundle;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

import androidx.databinding.ViewDataBinding;
import cn.ming.wfchat.R;
import cn.ming.wfchat.databinding.DialogCurrencyListBinding;
import cn.ming.wfchat.kit.dialog.CenterDialog;

/**
 * @author luoming
 * created at 2020-05-09 22:24
 * 币种列表弹框
 */
public class CurrencyListDialog extends CenterDialog {
    private DialogCurrencyListBinding binding;
    private OnClickListener onClickListener;

    /**
     * 定义结果回调接口
     */
    public interface OnClickListener {
        void goOk(String selected);
    }

    public CurrencyListDialog setOnClickListener(OnClickListener onClickListener) {
        this.onClickListener = onClickListener;
        return this;
    }


    @Override
    public int getLayoutId() {
        return R.layout.dialog_currency_list;
    }


    public static CurrencyListDialog newInstance() {
        CurrencyListDialog dialog = new CurrencyListDialog();
        Bundle bundle = new Bundle();
        dialog.setArguments(bundle);
        return dialog;
    }


    @Override
    public void initView(ViewDataBinding dataBinding) {
        binding = (DialogCurrencyListBinding) dataBinding;
        List<String> datas = new ArrayList<>();
        datas.add("ETH_USDT");
        datas.add("ETH");
        datas.add("TRX_USDT");
        datas.add("TRX");
        datas.add("FJ");
        binding.pickerView.setData(datas);
        binding.tvOk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
                onClickListener.goOk(binding.pickerView.getSelected());
            }
        });

    }

    @Override
    public boolean isBottom() {
        return true;
    }

    @Override
    public boolean isCancele() {
        return true;
    }

}
